using System;
using System.IO.IsolatedStorage;
namespace MicroMsg.Storage
{
	public class AccountStorage
	{
		private string getXmlFilePath(string userName)
		{
			return StorageIO.getAccountPath(userName) + "/" + userName + ".xml";
		}
		public Account method_0(string userName)
		{
			if (string.IsNullOrEmpty(userName))
			{
				return null;
			}
			return StorageXml.loadFromFile<Account>(this.getXmlFilePath(userName));
		}
		public bool method_1(string userName)
		{
			if (string.IsNullOrEmpty(userName))
			{
				return false;
			}
			try
			{
				using (IsolatedStorageFile userStoreForApplication = IsolatedStorageFile.GetUserStoreForApplication())
				{
					if (userStoreForApplication.FileExists(this.getXmlFilePath(userName)))
					{
						userStoreForApplication.DeleteFile(this.getXmlFilePath(userName));
					}
				}
			}
			catch (Exception)
			{
			}
			return true;
		}
		public bool update(Account item)
		{
			if (item == null || string.IsNullOrEmpty(item.strUsrName))
			{
				return false;
			}
			if (StorageXml.saveToFile<Account>(item, this.getXmlFilePath(item.strUsrName)))
			{
				return true;
			}
			StorageXml.FilterInvalidCharacters(item);
			return StorageXml.saveToFile<Account>(item, this.getXmlFilePath(item.strUsrName));
		}
		public static void test()
		{
		}
	}
}
